home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1994 November / macformat-018.iso / Utility Spectacular / Developer / demoCDEF ƒ / TogLib.h < prev    next >
Encoding:
Text File  |  1994-06-03  |  3.2 KB  |  71 lines  |  [TEXT/KAHL]

  1. //-------------------------------------------------------------------------------------
  2. // File        : TogLib.h
  3. // Purpose    : Function prototyes for  "Tog button" support routines
  4. // Author    : Jim Stout
  5. // Date        : November 2, 1991
  6. //-------------------------------------------------------------------------------------    
  7.  
  8. #define TOGUP    -1
  9. #define TOGDOWN     1
  10.  
  11. //-------------------------------------------------------------------------------------        
  12. //    Call initTogButtons before calling ModalDialog.
  13. //    
  14. //    Call it once for each group of "Tog Buttons" in the dialog.
  15. //    
  16. //    This function initializes the "goUP" flag (stored in the
  17. //    refCon of the first control.  It will be "up" unless the
  18. //    first control is ON, then it is "down".  If no controls
  19. //    are ON, it will turn on the first control.
  20. //-------------------------------------------------------------------------------------    
  21. void initTogButtons(
  22.     DialogPtr    theDialog,    // pretty obvious, the dialog with the buttons
  23.     short        first,        // the DITL item for button 1
  24.     short        last);        // the DITL item for the last button
  25.  
  26. //-------------------------------------------------------------------------------------    
  27.  
  28. //-------------------------------------------------------------------------------------        
  29. //    Call setTogButtons when the user clicks on a "Tog Button".
  30. //    
  31. //    Call it once for a click on one button in a group of
  32. //    "Tog Buttons" in the dialog.
  33. //    
  34. //    This is the key routine.  It will "do the right" thing for
  35. //    a "Tog Button" - turn it ON, OFF or make it jump to the
  36. //    next button - depending on the state of the other buttons
  37. //    in the group.  It also maintains the "goUP" flag.
  38. //-------------------------------------------------------------------------------------        
  39. void setTogButtons(
  40.     DialogPtr    theDialog,    // pretty obvious, the dialog with the buttons
  41.     short        itemHit,    // user clicked on this item.
  42.     short        first,        // the DITL item for button 1
  43.     short        last);        // the DITL item for the last button
  44.  
  45. //-------------------------------------------------------------------------------------        
  46.  
  47. //-------------------------------------------------------------------------------------        
  48. //    Call resetTogButtons whenever something that is NOT a "Tog Button" is clicked.
  49. //    
  50. //    This simply resets the "goUP" flag to the "up" direction.
  51. //-------------------------------------------------------------------------------------    
  52. void resetTogButtons(
  53.     DialogPtr    theDialog,    // pretty obvious, the dialog with the buttons
  54.     short        first);        // the DITL item for button 1
  55.  
  56. //-------------------------------------------------------------------------------------    
  57.  
  58. //-------------------------------------------------------------------------------------        
  59. //    Call setRadioButtons when the user clicks on a radio button.
  60. //    
  61. //    Call it once for a click on any button in a sequentially numbered
  62. //    group of radio buttons in the dialog.
  63. //-------------------------------------------------------------------------------------        
  64. void setRadioButtons(
  65.     DialogPtr    theDialog,    // pretty obvious, the dialog with the buttons
  66.     short        itemHit,    // user clicked on this item.
  67.     short        first,        // the DITL item for button 1
  68.     short        last);        // the DITL item for the last button
  69.  
  70. //-------------------------------------------------------------------------------------    
  71.